package com.xr.sys.servlet;

import java.io.IOException;
import java.io.Serializable;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.hibernate.Session;

import com.xr.common.constants.CommonConstants;
import com.xr.common.utils.HibernateSessionFactory;
import com.xr.common.utils.Spring;
import com.xr.sys.biz.LoginBiz;
import com.xr.sys.entity.Party;
import com.xr.sys.entity.SysUser;

public class LoginServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
    public LoginServlet() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println("登录~~");
		LoginBiz loginBiz = (LoginBiz) Spring.getBean("loginBiz");
		loginBiz.login("", "");
		System.out.println(111111);
//		Party party = new Party();
//		party.setName("p1");
//		party.setAge((byte) 12);
//		party.setSex(CommonConstants.SEX_MALE);
//		SysUser sysUser = new SysUser();
//		sysUser.setName("cjx");
//		sysUser.setParty(party);
//		sysUser.setPwd("123");
//		Session session = HibernateSessionFactory.getSession();
//		Party o = (Party) session.get(Party.class, 8L);
//		session.beginTransaction();
//		session.delete(o);
////		session.save(party);
////		session.save(sysUser);
//		session.getTransaction().commit();
//		System.out.println(o);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);
	}
}
